﻿create procedure [dbo].[usp_SqlLogInsert]
	@SqlLogId int = 0 output
	, @Message nvarchar(max)
as
begin
	set nocount on;
	
	set @SqlLogId = 0;
	
	begin try
	
		insert [dbo].[SqlLog]
		(
			[Message]
			, [User]
		)
		values
		(
            @Message
			, convert(sysname, CURRENT_USER)
		);
		
		select @SqlLogId = scope_identity();
		
	end try
	begin catch
		print 'an error occurred in stored procedure usp_SqlLogInsert';
		execute [dbo].[usp_SqlErrorInsert]
		return -1	
	end catch
end;
